package com.project.mapper;

import com.github.pagehelper.PageInfo;
import com.project.bean.ManBean;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

public interface IManMapper {
    /**
     * 添加
     * @param man
     */
    @Insert("insert into t_mans(m_name,m_birthday)values(#{name},#{birthday})")
    public void add(ManBean man );

    /**
     * 分页
     * @return
     */
    @Select("select * from t_mans ")
    @ResultMap("manMap")
    public List<ManBean> findAll();


    /**
     * 删除
     * @param id
     */
    @Delete("delete  from t_mans where pk_manId=#{id}")
    public void del(int id);


    /**
     * 修改
     * @param id
     * @param birthday
     */
    @Update("update t_mans set m_birthday=#{birthday} where pk_manId=#{id}")
    public void update(@Param("id") int id, @Param("birthday") LocalDate birthday);


    @Select("select * from t_mans where pk_manId=#{id}")
    @ResultMap("manMap")
    public ManBean findById(int id);
}
